package utils;

import java.util.*;

//import utils.*;
public class Display {
	 //print file and its each word tfidf in a order for 10 times
    public static void DisTfIdf(HashMap<String, TreeMap<String, Float>> tfidf){
        Iterator iter1 = tfidf.entrySet().iterator();
        
        while(iter1.hasNext()){
        	int count=0;
            Map.Entry entrys = (Map.Entry)iter1.next();
            System.out.println("FileName: " + entrys.getKey().toString());
            System.out.print("{");
            TreeMap<String, Float> temp = (TreeMap<String, Float>) entrys.getValue();
            Iterator iter2 = temp.entrySet().iterator();
            while(iter2.hasNext()){
                Map.Entry entry = (Map.Entry)iter2.next(); 
                System.out.print(entry.getKey().toString() + " = " + entry.getValue().toString() + ", ");
                if(count>=10){
                	break;
                }
                count++;
            }
            System.out.println("}");
        }   
    }
    
    //
    //Display selected Map
    public static void DisSelected(HashMap<String, HashMap<String,Integer>> selected){
        Iterator iter1 = selected.entrySet().iterator();
        
        while(iter1.hasNext()){
        	
            Map.Entry entrys = (Map.Entry)iter1.next();
            System.out.println("FileName: " + entrys.getKey().toString());
            System.out.print("{");
            HashMap<String,Integer> temp = (HashMap<String,Integer>) entrys.getValue();
            Iterator iter2 = temp.entrySet().iterator();
            while(iter2.hasNext()){
                Map.Entry entry = (Map.Entry)iter2.next(); 
                System.out.print(entry.getKey().toString() + " = " + entry.getValue().toString() + ", ");   
            }
            System.out.println("}");
        }   
    }
    
    //
    public static void DisWordsNum(HashMap<String,Integer> cmap){
    	System.out.println("words number for each-----");
    	for(String word:cmap.keySet()){	
    		System.out.println(word+"="+cmap.get(word).toString()+" ");
    	}
    }
    
    //
    public static void DisWordsPr(HashMap<String,Float> cprMap){
    	System.out.println("words Pr for each-----");
    	for(String word:cprMap.keySet()){	
    		System.out.println(word+"="+cprMap.get(word).toString()+" ");
    	}
    }
    
    //print the lable of class
    public static void DisClass(int flag){
    	if(flag==0){
    		System.out.println("    Auto");
    	}
    	if(flag==1){
    		System.out.println("    Education");
    	}
    	if(flag==2){
    		System.out.println("    Ent");
    	}
    	if(flag==3){
    		System.out.println("    Money");
    	}
    	if(flag==4){
    		System.out.println("    Sports");
    	}
    }
    
    //return the lable of class
    public static String getClassLable(int flag){
    	String lable="";
    	if(flag==0){
    		System.out.println("    Auto");
    		lable="    Auto"+"\r\n";
    	}
    	if(flag==1){
    		System.out.println("    Education");
    		lable="    Education"+"\r\n";
    	}
    	if(flag==2){
    		System.out.println("    Ent");
    		lable="    Ent"+"\r\n";
    	}
    	if(flag==3){
    		System.out.println("    Money");
    		lable="    Money"+"\r\n";
    	}
    	if(flag==4){
    		System.out.println("    Sports");
    		lable="    Sports"+"\r\n";
    	}
    	return lable;
    }
    
    ////////////////////////////
    public static void DisFeatureWords(HashMap<String,Float> cprMap){
    	String aa[]=null;
    	for(String word:cprMap.keySet()){
    		aa=word.split("/");
    		System.out.println(aa[0]);
    	}
    }
    
//************// 
}
